package com.test.shardingjdbc.service.impl;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.test.shardingjdbc.entity.UserEntity;
import com.test.shardingjdbc.mapper.UserEntityMapper;
import com.test.shardingjdbc.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author sunchuanyin
 * @version 1.0
 * @description
 * @date 2024/1/3 16:35
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserEntityMapper,UserEntity> implements UserService {


    @Resource
    private UserEntityMapper userEntityMapper;

    @Override
    public List<UserEntity> getList() {
        return this.list();
    }

    @Override
    public void insertUser() {
        UserEntity userEntity = new UserEntity();
        userEntity.setName("test");
        userEntity.setSex(1);
        userEntity.setPhone("15294673637");
        userEntity.setCreateTime(new Date());
        userEntity.setUpdateTime(new Date());
        this.save(userEntity);
    }
}
